import 'dart:ui';

import 'package:fish_redux/fish_redux.dart';
import 'package:www.znpigai.teacher/global_store/state.dart';

class WebState implements GlobalBaseState, Cloneable<WebState> {
  var progress = 0;
  var url = '';
  var title = '';
  var share = false;
  var done = '';
  Article article;
  Map<String, dynamic> homework;

  WebState(Map<String, dynamic> args) {
    if (args != null) {
      url = args['url'] ?? '';
      title = args['title'] ?? '';
      share = args['share'] ?? false;
      done = args['done'] ?? '';
      article = args['article'];
      homework = args['homework'];
    }
  }

  @override
  WebState clone() {
    return WebState(null)
      ..progress = progress
      ..title = title
      ..share = share
      ..done = done
      ..article = article
      ..homework = homework
      ..url = url;
  }

  @override
  Color themeColor;

  @override
  Map<String, dynamic> userInfo;
}

WebState initState(Map<String, dynamic> args) {
  return WebState(args);
}

class Article {
  var title = '';
  var content = '';
  var grade = '';
  var type = '';

  Article(this.title, this.content, this.grade, this.type);
}
